﻿using ShopEnzi.Data.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ShopEnzi.Data.Maps
{
    public class ProductMap : NH.Beng.NHClassIntMap<Product>
    {
        public ProductMap()
        {
            Map(x => x.City);
            Map(x => x.Description1).Length(500000);
            Map(x => x.Description2).Length(500000);
            Map(x => x.Description3).Length(500000);
            Map(x => x.FirmProductId);
            Map(x => x.ModelName);
            Map(x => x.ProductUrl).Length(4000);
            Map(x => x.ShortTitle).Length(500000);
            Map(x => x.Title).Length(500000);
            References(x => x.Firm);
            HasManyToMany(x => x.Categories).AsBag().Cascade.SaveUpdate().NotFound.Ignore().Table("CategoryToProduct");
            HasMany(x => x.Images);
            HasMany(x => x.Prices);

        }
    }
}
